'use strict';

import { basicAction } from '@peace/utils'
import { ApiTable } from '$utils'

export function worksafetyLogin(data) {
    return dispatch => basicAction({
        type: 'post',
        data,
        dispatch: dispatch,
        actionType: 'POST_WORKSAFETY_LOGIN',
        url: `${ApiTable.worksafetyLogin}`,
        msg: { error: '登录安监失败' },
    });
}

export function getEmerOrgList(query) {
    return dispatch => basicAction({
        type: 'get',
        query,
        dispatch: dispatch,
        actionType: 'GET_EMER_ORG_LIST',
        url: `${ApiTable.getEmerOrgList}`,
        msg: { error: '登录应急机构失败' },
    });
}

export function getEmerTeamList(query) {
    return dispatch => basicAction({
        type: 'get',
        query,
        dispatch: dispatch,
        actionType: 'GET_EMER_TEAM_LIST',
        url: `${ApiTable.getEmerTeamList}`,
        msg: { error: '登录应急队伍失败' },
    });
}

export function getEmerExpertList(query) {
    return dispatch => basicAction({
        type: 'get',
        query,
        dispatch: dispatch,
        actionType: 'GET_EMER_EXPERT_LIST',
        url: `${ApiTable.getEmerExpertList}`,
        msg: { error: '登录应急专家失败' },
    });
}

export function getEmerMedicalList(query) {
    return dispatch => basicAction({
        type: 'get',
        query,
        dispatch: dispatch,
        actionType: 'GET_EMER_MEDICAL_LIST',
        url: `${ApiTable.getEmerMedicalList}`,
        msg: { error: '登录医疗机构失败' },
    });
}

export function getEmerRefugeList(query) {
    return dispatch => basicAction({
        type: 'get',
        query,
        dispatch: dispatch,
        actionType: 'GET_EMER_REFUGE_LIST',
        url: `${ApiTable.getEmerRefugeList}`,
        msg: { error: '登录避难场所失败' },
    });
}